package com.qf.mvc2203.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/forw")
public class ForwController {
    /*
     * 转发到视图
     * */
    @RequestMapping("/test1")
    public String test1() {
        System.out.println("ForwController test1");
        //转发的完整的字符串写法
        return "forward:/views/user.html";
    }
    /*
    * 转发给另一个controller
    * */
    @RequestMapping("/test2")
    public String test2() {
        System.out.println("ForwController test2");
        return "forward:/user/get";
    }
    /*
    * 转发的相对路径的写法
    * */
    @RequestMapping("/test3")
    public String test3() {
        System.out.println("ForwController test3");
        //相对路径前面不写/，转发到当前的controller类的其他方法
        return "forward:test1";
    }
}
